﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace S.Authorization.Domain.Migrations
{
    public partial class fixmodel : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "ContactWay");

            migrationBuilder.DropTable(
                name: "EmergencyContact");

            migrationBuilder.DropTable(
                name: "SelfEvaluation");

            migrationBuilder.DropTable(
                name: "WorkExperience");

            migrationBuilder.DropColumn(
                name: "Category",
                table: "UsersModel");

            migrationBuilder.DropColumn(
                name: "Department",
                table: "UsersModel");

            migrationBuilder.DropColumn(
                name: "EmployeeUnit",
                table: "UsersModel");

            migrationBuilder.DropColumn(
                name: "GraduateDate",
                table: "UsersModel");

            migrationBuilder.DropColumn(
                name: "HealthExamTime",
                table: "UsersModel");

            migrationBuilder.DropColumn(
                name: "Hkadr",
                table: "UsersModel");

            migrationBuilder.DropColumn(
                name: "Nationality",
                table: "UsersModel");

            migrationBuilder.DropColumn(
                name: "Personnellevel",
                table: "UsersModel");

            migrationBuilder.RenameColumn(
                name: "Post",
                table: "UsersModel",
                newName: "DepartmentId");

            migrationBuilder.RenameColumn(
                name: "Position",
                table: "UsersModel",
                newName: "BusinessId");

            migrationBuilder.RenameColumn(
                name: "PoliticsStatus",
                table: "UsersModel",
                newName: "Area");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "DepartmentId",
                table: "UsersModel",
                newName: "Post");

            migrationBuilder.RenameColumn(
                name: "BusinessId",
                table: "UsersModel",
                newName: "Position");

            migrationBuilder.RenameColumn(
                name: "Area",
                table: "UsersModel",
                newName: "PoliticsStatus");

            migrationBuilder.AddColumn<int>(
                name: "Category",
                table: "UsersModel",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "Department",
                table: "UsersModel",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "EmployeeUnit",
                table: "UsersModel",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<DateTime>(
                name: "GraduateDate",
                table: "UsersModel",
                type: "datetime2",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "HealthExamTime",
                table: "UsersModel",
                type: "datetime2",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Hkadr",
                table: "UsersModel",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "Nationality",
                table: "UsersModel",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "Personnellevel",
                table: "UsersModel",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateTable(
                name: "ContactWay",
                columns: table => new
                {
                    ContactWayID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Address = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Area = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    City = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Email = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
                    Phone = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Province = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    QQ = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    UserId = table.Column<int>(type: "int", nullable: false),
                    WeChat = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ContactWay", x => x.ContactWayID);
                });

            migrationBuilder.CreateTable(
                name: "EmergencyContact",
                columns: table => new
                {
                    EmergencyContactId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Area = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    City = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    ContactAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    ContactPhone = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Province = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    UserId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmergencyContact", x => x.EmergencyContactId);
                });

            migrationBuilder.CreateTable(
                name: "SelfEvaluation",
                columns: table => new
                {
                    SelfEvaluationId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Attachments = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    SelfEvaluationDesc = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    UserId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SelfEvaluation", x => x.SelfEvaluationId);
                });

            migrationBuilder.CreateTable(
                name: "WorkExperience",
                columns: table => new
                {
                    WorkExperienceId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Department = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Position = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    ReasonForResignation = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                    UserId = table.Column<int>(type: "int", nullable: false),
                    WorkContent = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    WorkUnit = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    WorkingTimeEnd = table.Column<DateTime>(type: "datetime2", nullable: true),
                    WorkingTimeStart = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WorkExperience", x => x.WorkExperienceId);
                });
        }
    }
}
